<html><head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>DrawText</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<font face="Verdana, sans-serif" size="2"><p align="center"><b><font size="4">DrawText()</font></b></p>
<p><b>语法</b></p><blockquote>

Result = <font color="#3A3966"><b>DrawText</b></font>(x, y, Text$ [, FrontColor [, BackColor]])</blockquote>

</blockquote>
<b>概要</b><br><blockquote>



Display the given string on the current output at the given x,y position. 
The current output is set with <a href="startdrawing.html">StartDrawing()</a>. 

 

</blockquote><p><b>参数</b></p><blockquote>
<style type="text/css">
table.parameters { border-spacing: 0px; border-style: none; border-collapse: collapse; }
table.parameters td { border-width: 1px; padding: 6px; border-style: solid; border-color: gray; vertical-align: top; font-family:Arial; font-size:10pt; }
</style>
<table width="90%" class="parameters">
<tr><td width="10%"><i>x, y</i></td>
<td width="90%"> 
 
The location at which to draw the text. 

 

</td></tr>
<tr><td><i>Text$</i></td>
<td> 
 
The text to draw. 

 

</td></tr>
<tr><td><i>FrontColor (optional)</i></td>
<td> 
The color to be used for the text. 如果未指定此参数，将使用与<a href="frontcolor.html">FrontColor()</a>设置的默认颜色。这种颜色可以使用<a href="rgb.html">RGB</a>或<a href="rgba.html">RGBA</a>格式。 

</td></tr>
<tr><td><i>BackColor (optional)</i></td>
<td> 
 
The color to be used for the background. If this parameter is not specified, the default color 
set with <a href="backcolor.html">BackColor()</a> will be used. 
<br>
<br>
If the current <a href="drawingmode.html">DrawingMode()</a> includes the <font color="#924B72">#PB_2DDrawing_Transparent</font> flag, 
then this parameter is ignored and the background is transparent. 

 

</td></tr>
</table>
</blockquote><p><b>返回值</b></p><blockquote>



Returns the new x position of the text cursor (ie the location just after the printed text). 

 

</blockquote><p><b>备注</b></p><blockquote>



If <a href="drawingmode.html">DrawingMode()</a> is set to non-transparent background 
and the current drawing mode uses the alpha channel then the text is first blended onto the background 
and then applied to the drawing output. 

 

</blockquote><p><b>示例</b></p><blockquote>

<pre><font face="Courier New, Courier, mono"size="2">  <b><font color="#3A3966">If</font></b> <font color="#3A3966">OpenWindow</font>(0, 0, 0, 200, 200, "2DDrawing Example", <font color="#924B72">#PB_Window_SystemMenu</font> | <font color="#924B72">#PB_Window_ScreenCentered</font>)
    <b><font color="#3A3966">If</font></b> <font color="#3A3966">CreateImage</font>(0, 200, 200) <b><font color="#3A3966">And</font></b> <font color="#3A3966">StartDrawing</font>(<font color="#3A3966">ImageOutput</font>(0))
<font color="#3A3966">      DrawingMode</font>(<font color="#924B72">#PB_2DDrawing_Transparent</font>)
<font color="#3A3966">      Box</font>(0, 0, 200, 200,<font color="#3A3966"> RGB</font>(255, 255, 255))
      <b><font color="#3A3966">For</font></b> i = 1 <b><font color="#3A3966">To</font></b> 30
<font color="#3A3966">        DrawText</font>(<font color="#3A3966">Random</font>(200),<font color="#3A3966"> Random</font>(200), "Hello World!",<font color="#3A3966"> RGB</font>(<font color="#3A3966">Random</font>(255),<font color="#3A3966"> Random</font>(255),<font color="#3A3966"> Random</font>(255)))
      <b><font color="#3A3966">Next</font></b> i
<font color="#3A3966">      StopDrawing</font>() 
<font color="#3A3966">      ImageGadget</font>(0, 0, 0, 200, 200,<font color="#3A3966"> ImageID</font>(0))
    <b><font color="#3A3966">EndIf</font></b>
    
    <b><font color="#3A3966">Repeat</font></b>
      Event =<font color="#3A3966"> WaitWindowEvent</font>()
    <b><font color="#3A3966">Until</font></b> Event = <font color="#924B72">#PB_Event_CloseWindow</font>
  <b><font color="#3A3966">EndIf</font></b>
</font></pre>

<br>
<p><img src="../HelpPictures/text.png"></p>

</blockquote><p><b>参阅</b></p><blockquote>

<a href="drawrotatedtext.html">DrawRotatedText()</a>, <a href="drawingfont.html">DrawingFont()</a>, <a href="frontcolor.html">FrontColor()</a>, <a href="backcolor.html">BackColor()</a> 

</Blockquote><p><b>已支持操作系统 </b><Blockquote>所有</Blockquote></p><center>&lt;- <a href=drawrotatedtext.html>DrawRotatedText()</a> - <a href="index.html">2DDrawing Index</a> - <a href="drawingbuffer.html">DrawingBuffer()</a> -&gt;<br><br>

</body></html>